<html><body>

    <div><b>Hello, Admin ({{ admin }})!</b></div>
    
    <form name="form_shelter" action="/admin/shelter" method="post">
        <div>Shelter ID: <input type="text" name="shelter_id" value="{{ shelter_id }}"></input></div>
        <div>API Key: <input type="text" name="api_key" value="{{ api_key }}"></input></div>
        <div>API Secret: <input type="text" name="api_secret" value="{{ api_secret }}"></input></div>
        <div>Shelter Name: <input type="text" name="shelter_name" value="{{ shelter_name }}"></input></div>
        <div>Shelter Phone: <input type="text" name="shelter_phone" value="{{ shelter_phone }}"></input></div>
        <div>Shelter Email: <input type="text" name="shelter_email" value="{{ shelter_email }}"></input></div>
        <div>Shelter Email > Donations: <input type="text" name="shelter_email_donations" value="{{ shelter_email_donations }}"></input></div>
        <div>Shelter Address: <textarea name="shelter_address" rows="3" cols="60">{{ shelter_address }}</textarea></div>
        <div>Site Title: <textarea name="site_title" rows="3" cols="60">{{ site_title }}</textarea></div>
        <div>Site Description: <textarea name="site_description" rows="3" cols="60">{{ site_description }}</textarea></div>
        <div>Site Keywords: <textarea name="site_keywords" rows="3" cols="60">{{ site_keywords }}</textarea></div>
        <div>Site Footer: <textarea name="site_footer" rows="3" cols="60">{{ site_footer }}</textarea></div>
        <div>Site News & Events: <textarea name="site_news" rows="5" cols="60">{{ site_news }}</textarea></div>
        <div>Site About Us > Mission: <textarea name="site_about_us_mission" rows="5" cols="60">{{ site_about_us_mission }}</textarea></div>
        <div>Site About Us > Who: <textarea name="site_about_us_who" rows="5" cols="60">{{ site_about_us_who }}</textarea></div>
        <div>Site Contact Us > Emails: <textarea name="site_contact_us_emails" rows="5" cols="60">{{ site_contact_us_emails }}</textarea></div>
        <div>Shelter Facebook: <input type="text" name="shelter_facebook" value="{{ shelter_facebook }}"></input></div>
        <div>Shelter Twitter: <input type="text" name="shelter_twitter" value="{{ shelter_twitter }}"></input></div>
        <div>Google Analytics: <input type="text" name="google_analytics" value="{{ google_analytics }}"></input></div>
        <div><input type="submit" value="Setup Shelter"> <input type="reset" value="Reset"> <i>last update: {{ shelter_admin }}</i></div>
    </form>

    <form name="json_shelter" action="/admin/" method="post">
        <div>Shelter Data: <textarea name="json" rows="5" cols="60">{{ shelter_data }}</textarea></div>
        <div><input type="button" name="button" value="Populate Shelter" onclick="populateForm('shelter');"> <input type="reset" value="Reset"></div>
    </form>
    
    <form name="form_pets" action="/admin/util" method="get">
        <div><input type="submit" name="submit" value="Get Pets"><input type="submit" name="submit" value="Get All Pets"></div>
        <div><input type="submit" name="submit" value="Flush Cache"></div>
    </form>
    
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script> 
    <script type="text/javascript" src="/js/jquery.populate.min.js"></script>
    <script type="text/javascript"> 
    
        function populateForm(type){
            var form		= document.forms['form_' + type];
            var formJSON	= document.forms['json_' + type];
            
            var text		= formJSON['json'].value;
            text			= text.replace(/(^\s+|\s+$)/, '');
            text			= "(" + text + ");";
            
            try{
                var json = eval(text)
            } catch(err) {
                alert('That appears to be invalid JSON!')
                return false;
            }
            
            $(form).populate(json, {debug:1});
            
            return false;
        }
    		
    </script> 

</body></html>